#include "Date.h"
#include "stdio.h"

void Test1();
void Test2();
void Test3();
void Test4();
void Test5();
void TestMenu();

int main(){
  //Test2();  
  //Test3();
  //Test4();
  Test5();
  //TestMenu();
  return 0;
}

void Test1(){
  Date d1(2023,4,20); 
  Date d2 = d1;
  Date d3(2002,9,6);
  Date d4;
  
  d1.Print();
  d2.Print();
  d3.Print();
  d4.Print();

  cout << (d1 == d2) << endl;
  cout << (d1 == d3) << endl;
  cout << (d1 > d3) << endl;
  cout << (d3 > d1) << endl;

}
void Test2(){
  cout << "Test2:" << endl;
  Date today(2023,4,20);
  Date birthday(2002,9,6);
  Date start;
  today.Print();
  (today+30).Print();
  (today+300).Print();
  (today+3000).Print();
  (today+30000).Print();
  cout << endl;
  birthday.Print();
  (birthday-6).Print();
  (birthday-300).Print();
  (birthday-3000).Print();
  (birthday-30000).Print();
  cout << endl;
}

void Test3(){
  cout << "Test3:" << endl;
  Date today(2023,4,20);
  today++.Print();
  (++today).Print();
  today--.Print();
  (--today).Print();
}

void Test4(){
  cout << "Test4:" <<endl;
  Date d1(2023,4,21);
  Date start;
  cout << d1-start << endl;
  cout << start-d1 << endl;
  Date d2(2023,1,1);
  cout << d1-d2 <<endl;
  cout << d2-d1 <<endl;
  //Date origin(1,1,1);
  Date d3(2008,1,1);
  cout << d1-d3 <<endl;
  cout << d3-d1 <<endl;
  //cout << d3-origin << endl;
  //cout << origin - d3 << endl;
  //Date d4(0,0,0);
  //Date d4(2023,13,1);
}

void Test5(){
  cout << "Test5:" << endl;
  Date start;
  Date today(2023,4,21);
  Date birthday(2002,9,6);
  cout << start << endl << today << endl << birthday << endl;
  cout << birthday + 1000 << endl;
  Date d1,d2;
  cin >> d1 >> d2;
  cout << d1 << endl << d2 << endl;
}

void TestMenu(){
  int op = 0;
  Date d1, d2;
  int day;
  do{
    cout << "*********************************" << endl;
    cout << "*********1.日期加减天数**********" << endl;
    cout << "*********2.计算日期差************" << endl;
    cout << "*********3.计算星期几************" << endl;
    cout << "*********************************" << endl;
    cout << "请输入：" << endl;
    cin >> op;
    switch(op)
    {
      case 1:
        cout << "请输入日期及天数（正数为加，负数为减）：" << endl;
        cin >> d1 >> day;
        d2 = d1+day;
        cout << d2 << endl;
        break;
      case 2:
       cout << "请连续输入两个日期：" << endl;
       cin >> d1 >> d2;
       cout << (d1-d2) << endl;
        break;
      case 3:
        cout << "请输入日期：" << endl;
        cin >> d1;
        cout << d1 << endl;
        break;
      default:
        cout << "无此选项，请重新选择！" << endl;
        break;
    }
  }while(op!=-1);
}
